package cn.duxiaod.demo.producerconsumer.a;

import java.util.LinkedList;
import java.util.Queue;

public class ProducerConsumerTest {
    //队列大小
    private static final Integer CAPACTITY = 5;
    public static void main(String[] args) {
        Queue<Integer> queue = new LinkedList<>();
        Producer producer1 = new Producer("P-1", queue, CAPACTITY);
        Producer producer2 = new Producer("P-2",queue,CAPACTITY);
        Producer producer3 = new Producer("P-3",queue,CAPACTITY);

        Consumer consumer1 = new Consumer("C-1", queue, CAPACTITY);
        Consumer consumer2 = new Consumer("C-2", queue, CAPACTITY);
        //开始生产
        producer1.start();
        producer2.start();
        producer3.start();
        //开始消费
        consumer1.start();
        consumer2.start();
    }
}


